package com.sky.utils;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

public class ThreadLocalUtil {
    private static ThreadLocal<UserInfo> user = new ThreadLocal<>();

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    public static class UserInfo{
        public Long id;
    }

    public static void setUserInfo(UserInfo userInfo){
        user.set(userInfo);
    }

    public static UserInfo getUserInfo(){
        return user.get();
    }
    public static void removeUserInfo(){
        user.remove();
    }
}
